import api from "./request";
export const getCars = async (params) => {
  return await api.get("/cars", { params: params });
};
export const getCarNum = async () => {
  return await api.get("/carNum");
};
export const deleteCarById = async (id) => {
  return await api.delete(`/cars/${id}`);
};
export const getCarById = async(id)=>{
  return await api.get(`/cars/${id}`)
}
export const updateCarNum = async (carNum) => {
  return await api.put("/carNum/XH", { num: carNum });
};
export const getAreas = async () => {
  return await api.get("/areas");
};
export const postArea = async (data) => {
  return await api.post("/areas", data);
};
export const deleteAreaById = async (id) => {
  return await api.delete(`/areas/${id}`);
};

export const postCar = async (data) => {
  return await api.post("/cars", data);
};

export const getTrajectoryById = async(id)=>{
  return await api.get(`/trajectoryCars/${id}`);
}

export const updateCarById = async(id,data)=>{
  return await api.patch(`/cars/${id}`,data)
}

export const login = async(params)=>{
  return await api.get(`/users`,{params:params})
}